package com.sg.service.biz.bff.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.sg.common.util.CommonFunctionHelper;
import com.sg.common.util.RedisUtil;
import com.sg.dto.biz.bff.req.*;
import com.sg.dto.biz.bff.res.*;
import com.sg.dto.integration.component.ImplementSeparateAddOrDeleteDocListComReqDto;
import com.sg.dto.integration.component.ImplementSeparateAddOrDeleteDocListComRespDto;
import com.sg.service.biz.bff.PlanDataService;
import com.wicket.okrapp.integration.PlanDataService;
import com.wicket.okrapp.integration.UnstructuredDataService;
import com.wicket.okrapp.integration.dto.*;
import com.sg.common.exception.Assert;
import com.wicket.okrcomponent.integration.UnstructuredDataService;
import com.wicket.okrframework.integration.OrgService;
import com.wicket.okrframework.integration.dto.*;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.stream.Collectors;

/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Service
public class PlanDataServiceImpl implements PlanDataService {

    @Resource
    private RedisUtil redisUtil;
    @Resource
    com.sg.service.biz.app.PlanDataService fwAppPlanDataClient;

    @Resource
    com.sg.service.biz.framework.OrgService fwBaseOrgClient;
    @Resource
    com.sg.service.biz.app.UnstructuredDataService fwAppUnstructuredDataClient;
    @Resource
    com.sg.service.biz.component.UnstructuredDataService fwCompUnstructuredDataClient;

    /**
     * B3-5查规划资料列表[2534]
     * gen by moon at 11/2/2022, 8:08:18 AM
     */
    @Trace(operationName = "B3-5查规划资料列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryPlanDataListRespDto queryPlanDataList(BffQueryPlanDataListReqDto reqDto) {


        QueryPlanDataListRespDto queryPlanDataListRespDto_1 = null;
//步骤0: D3-5查询规划资料列表 - queryPlanDataList
        QueryPlanDataListRespDto queryPlanDataListRespDto = null;
        QueryPlanDataListReqDto queryPlanDataListReqDto = new QueryPlanDataListReqDto();
        queryPlanDataListReqDto.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:222495_1
        if (reqDto != null) {
            queryPlanDataListReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:388426_1
            queryPlanDataListReqDto.setEvaObjTargetCycleId(reqDto.getEvaObjTargetCycleId());//SimpleFieldAssign//sourceId:222577_1
            queryPlanDataListReqDto.setPlanSchemeClass(reqDto.getPlanSchemeClass());//SimpleFieldAssign//sourceId:116186_1
        }

        /*D3-5查询规划资料列表[2535]   */
        Assert.isNull(queryPlanDataListReqDto.getEvaluationTemplateId(), "B3-5查规划资料列表-D3-5查询规划资料列表-冗余评价模板ID不能为空", false);
        Assert.isNull(queryPlanDataListReqDto.getEvaObjTargetCycleId(), "B3-5查规划资料列表-D3-5查询规划资料列表-被评对象目标周期ID不能为空", false);
        Assert.isNull(queryPlanDataListReqDto.getPlanSchemeClass(), "B3-5查规划资料列表-D3-5查询规划资料列表-规划方案类别不能为空", false);
        Assert.isNull(queryPlanDataListReqDto.getSubjectLifeCycle(), "B3-5查规划资料列表-D3-5查询规划资料列表-主体生命周期不能为空", false);
        queryPlanDataListRespDto = fwAppPlanDataClient.queryPlanDataList(queryPlanDataListReqDto).getData();


        queryPlanDataListRespDto_1 = queryPlanDataListRespDto;

        BffQueryPlanDataListRespDto retData = new BffQueryPlanDataListRespDto();
        if (queryPlanDataListRespDto_1 != null) {
            retData.setPlanningList(queryPlanDataListRespDto_1.getPlanningList().stream().map(item -> BeanUtil.toBean(item, BffPlanningDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:116192_1
        }


        return retData;
    }

    /**
     * B3-5查规划资料详情[2525]
     * gen by moon at 6/9/2024, 1:22:50 AM
     */
    @Trace(operationName = "B3-5查规划资料详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryPlanDataDetailRespDto queryPlanDataDetail(BffQueryPlanDataDetailReqDto reqDto) {


        QueryPlanDataDetailRespDto queryPlanDataDetailRespDto_1 = null;
        QueryDeptSetDetailRespDto queryDeptSetDetailRespDto_1 = null;
//步骤0: D3-5查规划资料详情 - queryPlanDataDetail
        QueryPlanDataDetailRespDto queryPlanDataDetailRespDto = null;
        QueryPlanDataDetailReqDto queryPlanDataDetailReqDto = new QueryPlanDataDetailReqDto();
        queryPlanDataDetailReqDto.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:92907_1
        if (reqDto != null) {
            queryPlanDataDetailReqDto.setPlanningId(reqDto.getPlanningId());//SimpleFieldAssign//sourceId:78602_1
        }

        /*D3-5查规划资料详情[2516]   */
        Assert.isNull(queryPlanDataDetailReqDto.getPlanningId(), "B3-5查规划资料详情-D3-5查规划资料详情-规划资料ID不能为空", false);
        Assert.isNull(queryPlanDataDetailReqDto.getSubjectLifeCycle(), "B3-5查规划资料详情-D3-5查规划资料详情-主体生命周期不能为空", false);
        queryPlanDataDetailRespDto = fwAppPlanDataClient.queryPlanDataDetail(queryPlanDataDetailReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        queryPlanDataDetailRespDto_1 = queryPlanDataDetailRespDto;

//步骤1: D1-3查询部门设置详情(管理) - queryDeptSetDetail
        QueryDeptSetDetailRespDto queryDeptSetDetailRespDto = null;
        if (queryPlanDataDetailRespDto != null) {
            QueryDeptSetDetailReqDto queryDeptSetDetailReqDto = new QueryDeptSetDetailReqDto();
            queryDeptSetDetailReqDto.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:92002_1
            if (queryPlanDataDetailRespDto != null) {
                queryDeptSetDetailReqDto.setDeptId(queryPlanDataDetailRespDto.getDeptId());//SimpleFieldAssign//sourceId:91991_1
            }

            /*D1-3查询部门设置详情(管理)[657]   */
            Assert.isNull(queryDeptSetDetailReqDto.getSubjectLifeCycle(), "B3-5查规划资料详情-D1-3查询部门设置详情(管理)-主体生命周期不能为空", false);
            queryDeptSetDetailRespDto = fwBaseOrgClient.queryDeptSetDetail(queryDeptSetDetailReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


            queryDeptSetDetailRespDto_1 = queryDeptSetDetailRespDto;
        }

        BffQueryPlanDataDetailRespDto retData = new BffQueryPlanDataDetailRespDto();
        if (queryPlanDataDetailRespDto_1 != null) {
            retData.setPlanningId(queryPlanDataDetailRespDto_1.getPlanningId());//SimpleFieldAssign//sourceId:78612_1
            retData.setPlanningNumber(queryPlanDataDetailRespDto_1.getPlanningNumber());//SimpleFieldAssign//sourceId:78613_1
            retData.setPlanningName(queryPlanDataDetailRespDto_1.getPlanningName());//SimpleFieldAssign//sourceId:78614_1
            retData.setPlanningShortName(queryPlanDataDetailRespDto_1.getPlanningShortName());//SimpleFieldAssign//sourceId:78615_1
            retData.setHypertextContent(queryPlanDataDetailRespDto_1.getHypertextContent());//SimpleFieldAssign//sourceId:114317_1
            retData.setVirtualOrgDeptStatus(queryPlanDataDetailRespDto_1.getVirtualOrgDeptStatus());//SimpleFieldAssign//sourceId:78618_1
            retData.setDeptId(queryPlanDataDetailRespDto_1.getDeptId());//SimpleFieldAssign//sourceId:78617_1
            retData.setBusAppDocRelaList(queryPlanDataDetailRespDto_1.getBusAppDocRelaList().stream().map(item -> BeanUtil.toBean(item, BffBusAppDocRelaDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:78619_1
        }
        if (queryDeptSetDetailRespDto_1 != null) {
            retData.setDeptShortName(queryDeptSetDetailRespDto_1.getDeptShortName());//SimpleFieldAssign//sourceId:1135317_1
        }


        return retData;
    }

    /**
     * B3-5查询中层规划资料列表[4475]
     * gen by moon at 10/6/2022, 2:01:51 AM
     */
    @Trace(operationName = "B3-5查询中层规划资料列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryMidPlanDataListRespDto queryMidPlanDataList(BffQueryMidPlanDataListReqDto reqDto) {


        QueryMidPlanDataListRespDto queryMidPlanDataListRespDto_1 = null;
        BatchQueryDeptListRespDto batchQueryDeptListRespDto_1 = null;
//步骤0: D3-5查询中层规划资料列表 - queryMidPlanDataList
        QueryMidPlanDataListRespDto queryMidPlanDataListRespDto = null;
        QueryMidPlanDataListReqDto queryMidPlanDataListReqDto = new QueryMidPlanDataListReqDto();
        queryMidPlanDataListReqDto.setIsArchive("FALSE");//sourceId:312898_1
        queryMidPlanDataListReqDto.setArchivngType("NOT_ARCHIVE");//sourceId:312897_1
        if (reqDto != null) {
            queryMidPlanDataListReqDto.setDeptId(reqDto.getDeptId());//SimpleFieldAssign//sourceId:312635_1
            queryMidPlanDataListReqDto.setCycleId(reqDto.getCycleId());//SimpleFieldAssign//sourceId:312884_1
            queryMidPlanDataListReqDto.setPlanSchemeClass(reqDto.getPlanSchemeClass());//SimpleFieldAssign//sourceId:312637_1
            queryMidPlanDataListReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:312638_1
        }

        /*D3-5查询中层规划资料列表[4476]   */
        Assert.isNull(queryMidPlanDataListReqDto.getDeptId(), "B3-5查询中层规划资料列表-D3-5查询中层规划资料列表-牵头部门ID不能为空", false);
        Assert.isNull(queryMidPlanDataListReqDto.getCycleId(), "B3-5查询中层规划资料列表-D3-5查询中层规划资料列表-周期ID不能为空", false);
        Assert.isNull(queryMidPlanDataListReqDto.getPlanSchemeClass(), "B3-5查询中层规划资料列表-D3-5查询中层规划资料列表-规划方案类别不能为空", false);
        Assert.isNull(queryMidPlanDataListReqDto.getEvaluationTemplateId(), "B3-5查询中层规划资料列表-D3-5查询中层规划资料列表-冗余评价模板ID不能为空", false);
        Assert.isNull(queryMidPlanDataListReqDto.getIsArchive(), "B3-5查询中层规划资料列表-D3-5查询中层规划资料列表-是否存档不能为空", false);
        Assert.isNull(queryMidPlanDataListReqDto.getArchivngType(), "B3-5查询中层规划资料列表-D3-5查询中层规划资料列表-存档类型不能为空", false);
        queryMidPlanDataListRespDto = fwAppPlanDataClient.queryMidPlanDataList(queryMidPlanDataListReqDto).getData();


        queryMidPlanDataListRespDto_1 = queryMidPlanDataListRespDto;

//步骤1: D1-3批量查询部门列表	 - batchQueryDeptList
        BatchQueryDeptListRespDto batchQueryDeptListRespDto = null;
        if (queryMidPlanDataListRespDto != null) {
            BatchQueryDeptListReqDto batchQueryDeptListReqDto = new BatchQueryDeptListReqDto();
            batchQueryDeptListReqDto.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:312643_1
            if (queryMidPlanDataListRespDto != null) {
                batchQueryDeptListReqDto.setDeptList(queryMidPlanDataListRespDto.getPlanningList().stream().map(item -> item.getDeptId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:312641_1
            }

            /*D1-3批量查询部门列表	[1182]   */
            Assert.isNull(batchQueryDeptListReqDto.getSubjectLifeCycle(), "B3-5查询中层规划资料列表-D1-3批量查询部门列表	-主体生命周期不能为空", false);
            batchQueryDeptListRespDto = fwBaseOrgClient.batchQueryDeptList(batchQueryDeptListReqDto).getData();


            batchQueryDeptListRespDto_1 = batchQueryDeptListRespDto;
        }

        BffQueryMidPlanDataListRespDto retData = new BffQueryMidPlanDataListRespDto();
        //todo master集合数量为0,请联系业务设计人员检查,是否设置了master集合?;关联关系如下:retData.getPlanningList().setPlanningId(queryMidPlanDataListRespDto_1.getPlanningList().getPlanningId());retData.getPlanningList().setPlanningShortName(queryMidPlanDataListRespDto_1.getPlanningList().getPlanningShortName());retData.getPlanningList().setDeptId(queryMidPlanDataListRespDto_1.getPlanningList().getDeptId());retData.getPlanningList().setDeptShortName(batchQueryDeptListRespDto_1.getDeptList().getDeptShortName())


        return retData;
    }

    /**
     * B3-5查询管理模式规划资料列表(管理)[2884]
     * gen by moon at 11/2/2022, 8:08:31 AM
     */
    @Trace(operationName = "B3-5查询管理模式规划资料列表(管理)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryPlanDataMgtListRespDto queryPlanDataMgtList(BffQueryPlanDataMgtListReqDto reqDto) {


        QueryPlanDataListRespDto queryPlanDataListRespDto_1 = null;
//步骤0: D3-5查询规划资料列表 - queryPlanDataList
        QueryPlanDataListRespDto queryPlanDataListRespDto = null;
        QueryPlanDataListReqDto queryPlanDataListReqDto = new QueryPlanDataListReqDto();
        queryPlanDataListReqDto.setIsArchive("FALSE");//sourceId:116177_1
        if (reqDto != null) {
            queryPlanDataListReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:388428_1
            queryPlanDataListReqDto.setEvaObjTargetCycleId(reqDto.getEvaObjTargetCycleId());//SimpleFieldAssign//sourceId:222579_1
            queryPlanDataListReqDto.setPlanSchemeClass(reqDto.getPlanSchemeClass());//SimpleFieldAssign//sourceId:116176_1
        }

        /*D3-5查询规划资料列表[2535]   */
        Assert.isNull(queryPlanDataListReqDto.getEvaluationTemplateId(), "B3-5查询管理模式规划资料列表(管理)-D3-5查询规划资料列表-冗余评价模板ID不能为空", false);
        Assert.isNull(queryPlanDataListReqDto.getEvaObjTargetCycleId(), "B3-5查询管理模式规划资料列表(管理)-D3-5查询规划资料列表-被评对象目标周期ID不能为空", false);
        Assert.isNull(queryPlanDataListReqDto.getPlanSchemeClass(), "B3-5查询管理模式规划资料列表(管理)-D3-5查询规划资料列表-规划方案类别不能为空", false);
        Assert.isNull(queryPlanDataListReqDto.getIsArchive(), "B3-5查询管理模式规划资料列表(管理)-D3-5查询规划资料列表-是否存档不能为空", false);
        queryPlanDataListRespDto = fwAppPlanDataClient.queryPlanDataList(queryPlanDataListReqDto).getData();


        queryPlanDataListRespDto_1 = queryPlanDataListRespDto;

        BffQueryPlanDataMgtListRespDto retData = new BffQueryPlanDataMgtListRespDto();
        if (queryPlanDataListRespDto_1 != null) {
            retData.setPlanDataMgtList(queryPlanDataListRespDto_1.getPlanningList().stream().map(item -> BeanUtil.toBean(item, BffPlanDataMgtDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:116183_1
        }


        return retData;
    }

    /**
     * B3-5查询管理模式规划资料详情(管理)[2896]
     * gen by moon at 11/30/2022, 5:59:35 PM
     */
    @Trace(operationName = "B3-5查询管理模式规划资料详情(管理)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryPlanDataMgtDetailRespDto queryPlanDataMgtDetail(BffQueryPlanDataMgtDetailReqDto reqDto) {


        QueryPlanDataDetailRespDto queryPlanDataDetailRespDto_1 = null;
        QueryDeptDetailComBorderRespDto queryDeptDetailComBorderRespDto_1 = null;
//步骤0: D3-5查规划资料详情 - queryPlanDataDetail
        QueryPlanDataDetailRespDto queryPlanDataDetailRespDto = null;
        QueryPlanDataDetailReqDto queryPlanDataDetailReqDto = new QueryPlanDataDetailReqDto();
        queryPlanDataDetailReqDto.setIsArchive("FALSE");//sourceId:92917_1
        if (reqDto != null) {
            queryPlanDataDetailReqDto.setPlanningId(reqDto.getPlanningId());//SimpleFieldAssign//sourceId:92908_1
        }

        /*D3-5查规划资料详情[2516]   */
        Assert.isNull(queryPlanDataDetailReqDto.getPlanningId(), "B3-5查询管理模式规划资料详情(管理)-D3-5查规划资料详情-规划资料ID不能为空", false);
        Assert.isNull(queryPlanDataDetailReqDto.getIsArchive(), "B3-5查询管理模式规划资料详情(管理)-D3-5查规划资料详情-是否存档不能为空", false);
        queryPlanDataDetailRespDto = fwAppPlanDataClient.queryPlanDataDetail(queryPlanDataDetailReqDto).getData();


        queryPlanDataDetailRespDto_1 = queryPlanDataDetailRespDto;

//步骤1: D1-3查询部门详情(公共)(边界) - queryDeptDetailComBorder
        QueryDeptDetailComBorderRespDto queryDeptDetailComBorderRespDto = null;
        if (queryPlanDataDetailRespDto != null) {
            QueryDeptDetailComBorderReqDto queryDeptDetailComBorderReqDto = new QueryDeptDetailComBorderReqDto();
            if (queryPlanDataDetailRespDto != null) {
                queryDeptDetailComBorderReqDto.setDeptId(queryPlanDataDetailRespDto.getDeptId());//SimpleFieldAssign//sourceId:92927_1
            }

            /*D1-3查询部门详情(公共)(边界)[2691]   */
            Assert.isNull(queryDeptDetailComBorderReqDto.getDeptId(), "B3-5查询管理模式规划资料详情(管理)-D1-3查询部门详情(公共)(边界)-部门ID不能为空", false);
            queryDeptDetailComBorderRespDto = fwBaseOrgClient.queryDeptDetailComBorder(queryDeptDetailComBorderReqDto).getData();


            queryDeptDetailComBorderRespDto_1 = queryDeptDetailComBorderRespDto;
        }

        BffQueryPlanDataMgtDetailRespDto retData = new BffQueryPlanDataMgtDetailRespDto();
        if (queryPlanDataDetailRespDto_1 != null) {
            retData.setPlanningId(queryPlanDataDetailRespDto_1.getPlanningId());//SimpleFieldAssign//sourceId:92920_1
            retData.setPlanningNumber(queryPlanDataDetailRespDto_1.getPlanningNumber());//SimpleFieldAssign//sourceId:92921_1
            retData.setPlanningName(queryPlanDataDetailRespDto_1.getPlanningName());//SimpleFieldAssign//sourceId:92922_1
            retData.setPlanningShortName(queryPlanDataDetailRespDto_1.getPlanningShortName());//SimpleFieldAssign//sourceId:92923_1
            retData.setHypertextContent(queryPlanDataDetailRespDto_1.getHypertextContent());//SimpleFieldAssign//sourceId:114157_1
            retData.setDeptId(queryPlanDataDetailRespDto_1.getDeptId());//SimpleFieldAssign//sourceId:92925_1
            retData.setVirtualOrgDeptStatus(queryPlanDataDetailRespDto_1.getVirtualOrgDeptStatus());//SimpleFieldAssign//sourceId:92926_1
            retData.setTargetCategoryName(queryPlanDataDetailRespDto_1.getTargetCategoryName());//SimpleFieldAssign//sourceId:92964_1
            retData.setSubjectLifeCycle(queryPlanDataDetailRespDto_1.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:465921_1
            retData.setBusAppDocRelaList(queryPlanDataDetailRespDto_1.getBusAppDocRelaList().stream().map(item -> BeanUtil.toBean(item, BffBusAppDocRelaDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:93137_1
        }
        if (queryDeptDetailComBorderRespDto_1 != null) {
            retData.setDeptShortName(queryDeptDetailComBorderRespDto_1.getDeptShortName());//SimpleFieldAssign//sourceId:416445_1
        }


        return retData;
    }

    /**
     * B3-5新增规划资料(管理)[2885]
     * gen by moon at 6/9/2024, 1:22:58 AM
     */
    @Trace(operationName = "B3-5新增规划资料(管理)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffAddPlanDataRespDto addPlanData(BffAddPlanDataReqDto reqDto) {


        AddAllTypePlanDataRespDto addAllTypePlanDataRespDto_1 = null;
//步骤0: D3-5新增所有类型规划资料 - addAllTypePlanData
        AddAllTypePlanDataRespDto addAllTypePlanDataRespDto = null;
        AddAllTypePlanDataReqDto addAllTypePlanDataReqDto = new AddAllTypePlanDataReqDto();
        if (reqDto != null) {
            addAllTypePlanDataReqDto.setTargetCategoryId(reqDto.getTargetCategoryId());//SimpleFieldAssign//sourceId:222312_1
            addAllTypePlanDataReqDto.setEvaObjTargetCycleId(reqDto.getEvaObjTargetCycleId());//SimpleFieldAssign//sourceId:222313_1
            addAllTypePlanDataReqDto.setHypertextContent(reqDto.getHypertextContent());//SimpleFieldAssign//sourceId:222322_1
            addAllTypePlanDataReqDto.setPlanSchemeClass(reqDto.getPlanSchemeClass());//SimpleFieldAssign//sourceId:222314_1
            addAllTypePlanDataReqDto.setPlanningNumber(reqDto.getPlanningNumber());//SimpleFieldAssign//sourceId:222315_1
            addAllTypePlanDataReqDto.setPlanningName(reqDto.getPlanningName());//SimpleFieldAssign//sourceId:222316_1
            addAllTypePlanDataReqDto.setPlanningShortName(reqDto.getPlanningShortName());//SimpleFieldAssign//sourceId:222317_1
            addAllTypePlanDataReqDto.setDeptId(reqDto.getDeptId());//SimpleFieldAssign//sourceId:222318_1
            addAllTypePlanDataReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:222320_1
            addAllTypePlanDataReqDto.setEntityId(reqDto.getEntityId());//SimpleFieldAssign//sourceId:222321_1
        }
        if (reqDto != null && reqDto.getBusAppDocRelaList() != null && !CollectionUtil.isEmpty(reqDto.getBusAppDocRelaList())) {
            addAllTypePlanDataReqDto.setBusAppDocRelaList(reqDto.getBusAppDocRelaList().stream().map(item -> BeanUtil.toBean(item, BusAppDocRelaDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:748264_1
        }

        /*D3-5新增所有类型规划资料[4082]   */
        Assert.isNull(addAllTypePlanDataReqDto.getEvaObjTargetCycleId(), "B3-5新增规划资料(管理)-D3-5新增所有类型规划资料-被评对象目标周期ID不能为空", false);
        Assert.isNull(addAllTypePlanDataReqDto.getHypertextContent(), "B3-5新增规划资料(管理)-D3-5新增所有类型规划资料-超文本内容不能为空", false);
        Assert.isNull(addAllTypePlanDataReqDto.getPlanSchemeClass(), "B3-5新增规划资料(管理)-D3-5新增所有类型规划资料-规划方案类别不能为空", false);
        Assert.isNull(addAllTypePlanDataReqDto.getPlanningNumber(), "B3-5新增规划资料(管理)-D3-5新增所有类型规划资料-规划编号不能为空", false);
        Assert.isNull(addAllTypePlanDataReqDto.getPlanningName(), "B3-5新增规划资料(管理)-D3-5新增所有类型规划资料-规划名称不能为空", false);
        Assert.isNull(addAllTypePlanDataReqDto.getPlanningShortName(), "B3-5新增规划资料(管理)-D3-5新增所有类型规划资料-规划简称不能为空", false);
        Assert.isNull(addAllTypePlanDataReqDto.getDeptId(), "B3-5新增规划资料(管理)-D3-5新增所有类型规划资料-牵头部门ID不能为空", false);
        Assert.isNull(addAllTypePlanDataReqDto.getEvaluationTemplateId(), "B3-5新增规划资料(管理)-D3-5新增所有类型规划资料-冗余评价模板ID不能为空", false);
        Assert.isNull(addAllTypePlanDataReqDto.getEntityId(), "B3-5新增规划资料(管理)-D3-5新增所有类型规划资料-目标ID不能为空", false);
        addAllTypePlanDataRespDto = fwAppPlanDataClient.addAllTypePlanData(addAllTypePlanDataReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        addAllTypePlanDataRespDto_1 = addAllTypePlanDataRespDto;

        BffAddPlanDataRespDto retData = new BffAddPlanDataRespDto();
        if (addAllTypePlanDataRespDto_1 != null) {
            retData.setPlanningId(addAllTypePlanDataRespDto_1.getPlanningId());//SimpleFieldAssign//sourceId:222343_1
            retData.setHypertextContentId(addAllTypePlanDataRespDto_1.getHypertextContentId());//SimpleFieldAssign//sourceId:222344_1
        }


        return retData;
    }

    /**
     * B3-5删除规划资料(管理)[2901]
     * gen by moon at 10/8/2022, 3:09:16 AM
     */
    @Trace(operationName = "B3-5删除规划资料(管理)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffDeletePlanDataRespDto deletePlanData(BffDeletePlanDataReqDto reqDto) {


        //步骤0: D3-5删除规划资料 - deletePlanData
        DeletePlanDataRespDto deletePlanDataRespDto = null;
        DeletePlanDataReqDto deletePlanDataReqDto = new DeletePlanDataReqDto();
        if (reqDto != null) {
            deletePlanDataReqDto.setPlanningId(reqDto.getPlanningId());//SimpleFieldAssign//sourceId:222687_1
            deletePlanDataReqDto.setEntityId(reqDto.getEntityId());//SimpleFieldAssign//sourceId:222688_1
            deletePlanDataReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:329916_1
        }

        /*D3-5删除规划资料[2904]   */
        Assert.isNull(deletePlanDataReqDto.getPlanningId(), "B3-5删除规划资料(管理)-D3-5删除规划资料-规划资料ID不能为空", false);
        Assert.isNull(deletePlanDataReqDto.getEntityId(), "B3-5删除规划资料(管理)-D3-5删除规划资料-目标ID不能为空", false);
        Assert.isNull(deletePlanDataReqDto.getEvaluationTemplateId(), "B3-5删除规划资料(管理)-D3-5删除规划资料-冗余评价模板ID不能为空", false);
        deletePlanDataRespDto = fwAppPlanDataClient.deletePlanData(deletePlanDataReqDto).getData();


        BffDeletePlanDataRespDto retData = new BffDeletePlanDataRespDto();


        return retData;
    }

    /**
     * B3-新增规划资料文档关系[4090]
     * gen by moon at 7/18/2024, 6:41:43 PM
     */
    @Trace(operationName = "B3-新增规划资料文档关系")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffAddBusAppDocRelaRespDto addBusAppDocRela(BffAddBusAppDocRelaReqDto reqDto) {


        //步骤0: D3查询规划资料详情by主键(公共) - queryPlanDataByPrimaryKeyDetailCom
        QueryPlanDataByPrimaryKeyDetailComRespDto queryPlanDataByPrimaryKeyDetailComRespDto = null;
        QueryPlanDataByPrimaryKeyDetailComReqDto queryPlanDataByPrimaryKeyDetailComReqDto = new QueryPlanDataByPrimaryKeyDetailComReqDto();
        queryPlanDataByPrimaryKeyDetailComReqDto.setIsArchive("FALSE");//sourceId:1859699_1
        if (reqDto != null) {
            queryPlanDataByPrimaryKeyDetailComReqDto.setPlanningId(reqDto.getEntityId());//SimpleFieldAssign//sourceId:1859680_1
            queryPlanDataByPrimaryKeyDetailComReqDto.setEvaluationTemplateId(reqDto.getThemeContentId());//SimpleFieldAssign//sourceId:1859681_1
        }

        /*D3查询规划资料详情by主键(公共)[9776]   */
        Assert.isNull(queryPlanDataByPrimaryKeyDetailComReqDto.getPlanningId(), "B3-新增规划资料文档关系-D3查询规划资料详情by主键(公共)-规划资料ID不能为空", false);
        Assert.isNull(queryPlanDataByPrimaryKeyDetailComReqDto.getEvaluationTemplateId(), "B3-新增规划资料文档关系-D3查询规划资料详情by主键(公共)-冗余评价模板ID不能为空", false);
        Assert.isNull(queryPlanDataByPrimaryKeyDetailComReqDto.getIsArchive(), "B3-新增规划资料文档关系-D3查询规划资料详情by主键(公共)-是否存档不能为空", false);
        queryPlanDataByPrimaryKeyDetailComRespDto = fwAppPlanDataClient.queryPlanDataByPrimaryKeyDetailCom(queryPlanDataByPrimaryKeyDetailComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


//步骤1: D3执行准备规划相关资料文档关系(公共) - implementPerpareDataDocRelOrDocCom
        ImplementPerpareDataDocRelOrDocComRespDto implementPerpareDataDocRelOrDocComRespDto = null;
        if (queryPlanDataByPrimaryKeyDetailComRespDto != null) {
            ImplementPerpareDataDocRelOrDocComReqDto implementPerpareDataDocRelOrDocComReqDto = new ImplementPerpareDataDocRelOrDocComReqDto();
            if (queryPlanDataByPrimaryKeyDetailComRespDto != null) {
                implementPerpareDataDocRelOrDocComReqDto.setEvaObjTargetCycleId(queryPlanDataByPrimaryKeyDetailComRespDto.getEvaObjTargetCycleId());//SimpleFieldAssign//sourceId:1859429_1
                implementPerpareDataDocRelOrDocComReqDto.setEvaluationTemplateId(queryPlanDataByPrimaryKeyDetailComRespDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:1859430_1
            }

            /*D3执行准备规划相关资料文档关系(公共)[9775]   */
            Assert.isNull(implementPerpareDataDocRelOrDocComReqDto.getEvaObjTargetCycleId(), "B3-新增规划资料文档关系-D3执行准备规划相关资料文档关系(公共)-被评对象目标周期ID不能为空", false);
            Assert.isNull(implementPerpareDataDocRelOrDocComReqDto.getEvaluationTemplateId(), "B3-新增规划资料文档关系-D3执行准备规划相关资料文档关系(公共)-冗余评价模板ID不能为空", false);
            implementPerpareDataDocRelOrDocComRespDto = fwAppUnstructuredDataClient.implementPerpareDataDocRelOrDocCom(implementPerpareDataDocRelOrDocComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        }

//步骤2: D2执行分离新增或删除文档列表(公共) - implementSeparateAddOrDeleteDocListCom
        ImplementSeparateAddOrDeleteDocListComRespDto implementSeparateAddOrDeleteDocListComRespDto = null;
        if (implementPerpareDataDocRelOrDocComRespDto != null) {
            ImplementSeparateAddOrDeleteDocListComReqDto implementSeparateAddOrDeleteDocListComReqDto = new ImplementSeparateAddOrDeleteDocListComReqDto();
            implementSeparateAddOrDeleteDocListComReqDto.setIsCleanPersonalInvalidDocument("TRUE");//sourceId:1934779_1
            implementSeparateAddOrDeleteDocListComReqDto.setDocUseSceneCode("PLANNING");//sourceId:1858629_1
            implementSeparateAddOrDeleteDocListComReqDto.setDocUseType("PLAN_DATA");//sourceId:1858630_1
            implementSeparateAddOrDeleteDocListComReqDto.setIsResult("FALSE");//sourceId:1859373_1
            implementSeparateAddOrDeleteDocListComReqDto.setOwnTableTypeCode("OMS_PLANNING");//sourceId:1858632_1
            implementSeparateAddOrDeleteDocListComReqDto.setThemeContentTypeCode("OMS_EVALUATION_TEMPLATE");//sourceId:1858636_1
            implementSeparateAddOrDeleteDocListComReqDto.setUserId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecUserId());//CURRENT_USERID//sourceId:1858638_1
            implementSeparateAddOrDeleteDocListComReqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:1858627_1
            if (reqDto != null && reqDto.getDocumentList() != null && !CollectionUtil.isEmpty(reqDto.getDocumentList())) {
                implementSeparateAddOrDeleteDocListComReqDto.setDocumentList(reqDto.getDocumentList().stream().map(item -> BeanUtil.toBean(item, com.wicket.okrcomponent.integration.dto.DocumentDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:1858628_1
            }
            if (reqDto != null) {
                implementSeparateAddOrDeleteDocListComReqDto.setOwnEntityId(reqDto.getEntityId());//SimpleFieldAssign//sourceId:1858626_1
                implementSeparateAddOrDeleteDocListComReqDto.setThemeContentId(reqDto.getThemeContentId());//SimpleFieldAssign//sourceId:1858637_1
            }
            if (implementPerpareDataDocRelOrDocComRespDto != null) {
                implementSeparateAddOrDeleteDocListComReqDto.setOwnWorkCycleId(implementPerpareDataDocRelOrDocComRespDto.getCycleId());//SimpleFieldAssign//sourceId:1859435_1
                implementSeparateAddOrDeleteDocListComReqDto.setOwnParentContentTypeCode(implementPerpareDataDocRelOrDocComRespDto.getTableTypeCode());//SimpleFieldAssign//sourceId:1858641_1
                implementSeparateAddOrDeleteDocListComReqDto.setOwnParentContentCode(implementPerpareDataDocRelOrDocComRespDto.getEvaObjTargetCycleCode());//SimpleFieldAssign//sourceId:1858634_1
                implementSeparateAddOrDeleteDocListComReqDto.setOwnParentContentId(implementPerpareDataDocRelOrDocComRespDto.getTargetCycleContentId());//SimpleFieldAssign//sourceId:1858635_1
            }

            /*D2执行分离新增或删除文档列表(公共)[8783]   */
            Assert.isNull(implementSeparateAddOrDeleteDocListComReqDto.getIsCleanPersonalInvalidDocument(), "B3-新增规划资料文档关系-D2执行分离新增或删除文档列表(公共)-是否清理个人无效文档不能为空", false);
            Assert.isNull(implementSeparateAddOrDeleteDocListComReqDto.getDocUseSceneCode(), "B3-新增规划资料文档关系-D2执行分离新增或删除文档列表(公共)-文档应用业务场景不能为空", false);
            Assert.isNull(implementSeparateAddOrDeleteDocListComReqDto.getDocUseType(), "B3-新增规划资料文档关系-D2执行分离新增或删除文档列表(公共)-文档用途类型不能为空", false);
            Assert.isNull(implementSeparateAddOrDeleteDocListComReqDto.getIsResult(), "B3-新增规划资料文档关系-D2执行分离新增或删除文档列表(公共)-冗余是否结果文档不能为空", false);
            Assert.isNull(implementSeparateAddOrDeleteDocListComReqDto.getOwnEntityId(), "B3-新增规划资料文档关系-D2执行分离新增或删除文档列表(公共)-归属内容表主键ID不能为空", false);
            Assert.isNull(implementSeparateAddOrDeleteDocListComReqDto.getOwnTableTypeCode(), "B3-新增规划资料文档关系-D2执行分离新增或删除文档列表(公共)-归属内容表类型编码不能为空", false);
            Assert.isNull(implementSeparateAddOrDeleteDocListComReqDto.getOwnWorkCycleId(), "B3-新增规划资料文档关系-D2执行分离新增或删除文档列表(公共)-归属工作周期ID不能为空", false);
            Assert.isNull(implementSeparateAddOrDeleteDocListComReqDto.getOwnParentContentTypeCode(), "B3-新增规划资料文档关系-D2执行分离新增或删除文档列表(公共)-归属父内容表类型编码不能为空", false);
            Assert.isNull(implementSeparateAddOrDeleteDocListComReqDto.getOwnParentContentCode(), "B3-新增规划资料文档关系-D2执行分离新增或删除文档列表(公共)-归属父内容标识不能为空", false);
            Assert.isNull(implementSeparateAddOrDeleteDocListComReqDto.getOwnParentContentId(), "B3-新增规划资料文档关系-D2执行分离新增或删除文档列表(公共)-归属父内容表主键ID不能为空", false);
            Assert.isNull(implementSeparateAddOrDeleteDocListComReqDto.getThemeContentTypeCode(), "B3-新增规划资料文档关系-D2执行分离新增或删除文档列表(公共)-主题内容表类型编码不能为空", false);
            Assert.isNull(implementSeparateAddOrDeleteDocListComReqDto.getThemeContentId(), "B3-新增规划资料文档关系-D2执行分离新增或删除文档列表(公共)-主题内容ID不能为空", false);
            Assert.isNull(implementSeparateAddOrDeleteDocListComReqDto.getUserId(), "B3-新增规划资料文档关系-D2执行分离新增或删除文档列表(公共)-归属个人账号不能为空", false);
            Assert.isNull(implementSeparateAddOrDeleteDocListComReqDto.getSpaceId(), "B3-新增规划资料文档关系-D2执行分离新增或删除文档列表(公共)-创建于空间ID不能为空", false);
            implementSeparateAddOrDeleteDocListComRespDto = fwCompUnstructuredDataClient.implementSeparateAddOrDeleteDocListCom(implementSeparateAddOrDeleteDocListComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        }

        BffAddBusAppDocRelaRespDto retData = new BffAddBusAppDocRelaRespDto();


        return retData;
    }

    /**
     * B3更新当前规划资料(管理)[4097]
     * gen by moon at 10/8/2022, 3:10:41 AM
     */
    @Trace(operationName = "B3更新当前规划资料(管理)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffRefreshCurrentPlanDataRespDto refreshCurrentPlanData(BffRefreshCurrentPlanDataReqDto reqDto) {


        RefreshCurrentPlanDataRespDto refreshCurrentPlanDataRespDto_1 = null;
//步骤0: D3更新当前规划资料 - refreshCurrentPlanData
        RefreshCurrentPlanDataRespDto refreshCurrentPlanDataRespDto = null;
        RefreshCurrentPlanDataReqDto refreshCurrentPlanDataReqDto = new RefreshCurrentPlanDataReqDto();
        if (reqDto != null) {
            refreshCurrentPlanDataReqDto.setPlanningId(reqDto.getPlanningId());//SimpleFieldAssign//sourceId:222943_1
            refreshCurrentPlanDataReqDto.setEntityId(reqDto.getEntityId());//SimpleFieldAssign//sourceId:222944_1
            refreshCurrentPlanDataReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:329868_1
        }

        /*D3更新当前规划资料[4095]   */
        Assert.isNull(refreshCurrentPlanDataReqDto.getPlanningId(), "B3更新当前规划资料(管理)-D3更新当前规划资料-规划资料ID不能为空", false);
        Assert.isNull(refreshCurrentPlanDataReqDto.getEntityId(), "B3更新当前规划资料(管理)-D3更新当前规划资料-目标ID不能为空", false);
        refreshCurrentPlanDataRespDto = fwAppPlanDataClient.refreshCurrentPlanData(refreshCurrentPlanDataReqDto).getData();


        refreshCurrentPlanDataRespDto_1 = refreshCurrentPlanDataRespDto;

        BffRefreshCurrentPlanDataRespDto retData = new BffRefreshCurrentPlanDataRespDto();
        if (refreshCurrentPlanDataRespDto_1 != null) {
            retData.setPlanningId(refreshCurrentPlanDataRespDto_1.getPlanningId());//SimpleFieldAssign//sourceId:222951_1
        }


        return retData;
    }

    /**
     * B3存档当前规划资料(管理)[4099]
     * gen by moon at 10/8/2022, 3:10:42 AM
     */
    @Trace(operationName = "B3存档当前规划资料(管理)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffArchiveCurrentPlanDataRespDto archiveCurrentPlanData(BffArchiveCurrentPlanDataReqDto reqDto) {


        //步骤0: D3存档当前规划资料 - archiveCurrentPlanData
        ArchiveCurrentPlanDataRespDto archiveCurrentPlanDataRespDto = null;
        ArchiveCurrentPlanDataReqDto archiveCurrentPlanDataReqDto = new ArchiveCurrentPlanDataReqDto();
        if (reqDto != null) {
            archiveCurrentPlanDataReqDto.setPlanningId(reqDto.getPlanningId());//SimpleFieldAssign//sourceId:223196_1
            archiveCurrentPlanDataReqDto.setColumnContent(reqDto.getColumnContent());//SimpleFieldAssign//sourceId:223199_1
            archiveCurrentPlanDataReqDto.setEntityId(reqDto.getEntityId());//SimpleFieldAssign//sourceId:223197_1
            archiveCurrentPlanDataReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:329872_1
        }

        /*D3存档当前规划资料[4098]   */
        Assert.isNull(archiveCurrentPlanDataReqDto.getPlanningId(), "B3存档当前规划资料(管理)-D3存档当前规划资料-规划资料ID不能为空", false);
        Assert.isNull(archiveCurrentPlanDataReqDto.getColumnContent(), "B3存档当前规划资料(管理)-D3存档当前规划资料-规划简称不能为空", false);
        Assert.isNull(archiveCurrentPlanDataReqDto.getEntityId(), "B3存档当前规划资料(管理)-D3存档当前规划资料-目标ID不能为空", false);
        archiveCurrentPlanDataRespDto = fwAppPlanDataClient.archiveCurrentPlanData(archiveCurrentPlanDataReqDto).getData();


        BffArchiveCurrentPlanDataRespDto retData = new BffArchiveCurrentPlanDataRespDto();


        return retData;
    }

    /**
     * B3-5修改规划资料(管理)[2915]
     * gen by moon at 6/9/2024, 1:23:02 AM
     */
    @Trace(operationName = "B3-5修改规划资料(管理)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffUpdatePlanDataRespDto updatePlanData(BffUpdatePlanDataReqDto reqDto) {


        //步骤0: D3-5修改规划资料 - updatePlanData
        UpdatePlanDataRespDto updatePlanDataRespDto = null;
        UpdatePlanDataReqDto updatePlanDataReqDto = new UpdatePlanDataReqDto();
        if (reqDto != null) {
            updatePlanDataReqDto.setPlanningId(reqDto.getPlanningId());//SimpleFieldAssign//sourceId:93706_1
            updatePlanDataReqDto.setPlanningNumber(reqDto.getPlanningNumber());//SimpleFieldAssign//sourceId:93707_1
            updatePlanDataReqDto.setPlanningName(reqDto.getPlanningName());//SimpleFieldAssign//sourceId:93708_1
            updatePlanDataReqDto.setPlanningShortName(reqDto.getPlanningShortName());//SimpleFieldAssign//sourceId:93709_1
            updatePlanDataReqDto.setHypertextContent(reqDto.getHypertextContent());//SimpleFieldAssign//sourceId:162658_1
        }
        if (reqDto != null && reqDto.getBusAppDocRelaList() != null && !CollectionUtil.isEmpty(reqDto.getBusAppDocRelaList())) {
            updatePlanDataReqDto.setBusAppDocRelaList(reqDto.getBusAppDocRelaList().stream().map(item -> BeanUtil.toBean(item, BusAppDocRelaDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:748536_1
        }

        /*D3-5修改规划资料[2916]   */
        Assert.isNull(updatePlanDataReqDto.getPlanningId(), "B3-5修改规划资料(管理)-D3-5修改规划资料-规划资料ID不能为空", false);
        updatePlanDataRespDto = fwAppPlanDataClient.updatePlanData(updatePlanDataReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        BffUpdatePlanDataRespDto retData = new BffUpdatePlanDataRespDto();


        return retData;
    }
    //
}
